# 布局方式
# pack 按照放置的先后顺序排布
# grid 通过网格指定位置放置
# place 通过坐标定位方式放置

import tkinter as tk

class MyWindow():
    def __init__(self,app):
        self.app = app
        self.app.geometry("%dx%d+%d+%d" % (200,200,200,200))
        self.px = tk.PhotoImage(width=1,height=1)

        self.btn1 = tk.Button(app, text="按钮1", font=('黑体',20), image=self.px,compound="c",width=100,height=40)
        self.btn2 = tk.Button(app, text="按钮2", font=('黑体',20), image=self.px, compound="c",width=100,height=40)
        self.btn3 = tk.Button(app, text="按钮3", font=('黑体',20), image=self.px, compound="c",width=100,height=40)
        self.btn4 = tk.Button(app, text="按钮4", font=('黑体',20), image=self.px, compound="c",width=100,height=40)

        # pack 顺序放置
        # self.btn1.pack()
        # self.btn2.pack()
        # self.btn3.pack()
        # self.btn4.pack()

        # gird 网格放置
        # self.btn1.grid(row=0,column=0)
        # self.btn2.grid(row=0, column=1)
        # self.btn3.grid(row=1, column=0)
        # self.btn4.grid(row=1, column=1)

        # place 通过定位放置
        self.btn1.place(x=0,y=0)
        self.btn2.place(x=100,y=0)
        self.btn3.place(x=0,y=40)
        self.btn4.place(x=100,y=40)



if __name__ == '__main__':
    app = tk.Tk()
    window = MyWindow(app)
    app.mainloop()